package com.qy139.auth.controller;


import com.qy139.auth.service.ITabUserRoleService;
import com.qy139.entity.TabUserRole;
import com.qy139.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 用户和角色关联表 前端控制器
 * </p>
 *
 * @author yuhaochen
 * @since 2021-12-01
 */
@RestController
@RequestMapping("/tab-user-role")
public class TabUserRoleController {
    @Resource
    private ITabUserRoleService userRoleService;

    //查询用户现有角色
    @GetMapping("/getRolesIdByUid/{id}")
    public Result getRolesIdByUid(@PathVariable Integer id){
        return userRoleService.getRolesIdByUid(id);
    }

    //分配角色
    @PostMapping("/addRole")
    public Result addRole(Integer uid,String checkedRoles){
        return userRoleService.addRole(uid,checkedRoles);
    }
}

